<script type="text/javascript">
//全局变量
var GV = {
    DIMAUB: "__ROOT__/",
    JS_ROOT: "public/js/",
    TOKEN: ""
};
</script>
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/wind.js"></script>
<script src="__TMPL__Public/simpleboot/bootstrap/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/js/frontend.js"></script>
<script>
$(function(){
	$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
	
	$("#main-menu li.dropdown").hover(function(){
		$(this).addClass("open");
	},function(){
		$(this).removeClass("open");
	});
	
	$.get("{:leuu('user/index/is_login')}", function(data){
		if(data.status==1){
			if(data.user.avatar) {
				$("#main-menu-user .headicon").attr("src", data.user.avatar);
			}
			if(data.user.nicename.length>3){
                $("#main-menu-user .user-nicename").text(data.user.nicename.substring(0,3)+"...");
            }else{
                $("#main-menu-user .user-nicename").text(data.user.nicename);
            }

			$("#main-menu-user li.login").show();
		}
		if(data.status==0){
			$("#main-menu-user li.offline").show();
		}
	});	
	;(function($){
		$.fn.totop=function(opt){
			var scrolling=false;
			return this.each(function(){
				var $this=$(this);
				$(window).scroll(function(){
					if(!scrolling){
						var sd=$(window).scrollTop();
						if(sd>100){
							$this.fadeIn();
						}else{
							$this.fadeOut();
						}
					}
				});
				
				$this.click(function(){
					scrolling=true;
					$('html, body').animate({
						scrollTop : 0
					}, 500,function(){
						scrolling=false;
						$this.fadeOut();
					});
				});
			});
		};
	})(jQuery); 
	
	$("#backtotop").totop();
});
</script>